home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: owl3.office-workstations-ltd.co.uk!not-for-mail
- From: kenn@office-workstations-ltd.co.uk (Ken Nicolson)
- Subject: Re: HELP : Assignment with strings and pointers.
- Message-ID: <316bb0ec.1309731@newshost>
- Date: Wed, 10 Apr 1996 13:09:49 GMT
- References: <316ac5b5.4283622@news.planet.net> <4keairINN3jv@mayne.ugrad.cs.ubc.ca> <316B9FFA.ABD@wight.hursley.ibm.com>
- Organization: Office Workstations Limited
- Reply-To: kenn@owl-uk.co.uk
- X-Newsreader: Forte Agent .99d/32.182
-
- Max Waterman <dwater@wight.hursley.ibm.com> wrote:
-
- >Not alot of difference, though. But I'll bet I get flamed for this - I haven't checked it
- You *will* get flamed if you post wrong code offered as a solution, but at
- least you admit not to checking it. It is obvious that given the lines:
-
- > Size_T length_of_s2 = strlen( s2 );
- ...
- > Int s2_index = length_of_s2 - s1_index;
- > strings_are_same_backwards = ( s1[s1_index] == s2[s2_index] );
- when s1_index == 0 first time in, the expression "s2[s2_index]" is
- effectively s2[strlen( s2 )], the terminating '\0', not the last character
- in the string, so this routine will only work when s1 and s2 are empty
- strings.
-
- >- and people usually get flamed in this group, no matter what they say. It's quite
- No, people usually get flamed when they post incorrect information. A wrong
- answer is worse than no answer at all.
-
- Ken
-
-